/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.oai.metadataRepository.analysis.impl;

import cz.mzk.oai.metadataRepository.analysis.Analysis;
import cz.mzk.oai.metadataRepository.analysis.EnhanceResultOperation;
import cz.mzk.oai.metadataRepository.metadata.MetadataFormat;
import java.util.HashMap;
import java.util.Map;
import org.dom4j.DocumentHelper;
import org.dom4j.XPath;

/**
 *
 * @author Martin Řehánek (rehan at mzk.cz)
 */
public class EseElementAnalysis implements Analysis {

    private final String prefixedElementName;

    public EseElementAnalysis(String prefixedElementName) {
        this.prefixedElementName = prefixedElementName;
    }

    public MetadataFormat getMetadataFormat() {
        return MetadataFormat.ese;
    }

    public EnhanceResultOperation getOperation() {
        //return new HandInResultOperation();
        return new ClassifyLinksOperation();
    }

    public XPath getXpath() {
        Map<String, String> prefixNamespaceMap = new HashMap<String, String>();
        prefixNamespaceMap.put("europeana", "http://www.europeana.eu/schemas/ese/");
        prefixNamespaceMap.put("dc", "http://purl.org/dc/elements/1.1/");
        XPath elementXpath = DocumentHelper.createXPath("//europeana:metadata/europeana:record/" + prefixedElementName);
        elementXpath.setNamespaceURIs(prefixNamespaceMap);
        return elementXpath;
    }
}
